export const filterConfig = [
    {
        type: 'datetimerange',
        placeholder: '选择时间',
        label: '采样时间:',
        pickerOptions: {
            shortcuts: [
                {
                    text: '最近一天',
                    onClick(picker) {
                        const end = new Date()
                        const start = new Date()
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 1)
                        picker.$emit('pick', [start, end])
                    },
                },
                {
                    text: '最近三天',
                    onClick(picker) {
                        const end = new Date()
                        const start = new Date()
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 3)
                        picker.$emit('pick', [start, end])
                    },
                },
                {
                    text: '最近一周',
                    onClick(picker) {
                        const end = new Date()
                        const start = new Date()
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
                        picker.$emit('pick', [start, end])
                    },
                },
                {
                    text: '最近一个月',
                    onClick(picker) {
                        const end = new Date()
                        const start = new Date()
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
                        picker.$emit('pick', [start, end])
                    },
                },
                {
                    text: '最近三个月',
                    onClick(picker) {
                        const end = new Date()
                        const start = new Date()
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
                        picker.$emit('pick', [start, end])
                    },
                },
            ],
        },
    },
]

export const dilution = (list, number = 1000) => {
    if (list.length <= number) {
        return list // 如果列表长度小于或等于指定长度，则不进行稀释，直接返回原列表
    } else {
        const ratio = list.length / number
        const dilutedList = []
        for (let i = 0; i < list.length; i += ratio) {
            dilutedList.push(list[Math.floor(i)])
        }
        return dilutedList // 返回稀释后的列表
    }
}

export const unitsType = {
    wave: ['ms', ''],
    fre: ['HZ', '幅值'],
    '': ['', ''],
    rep: ['ms', ''],
}

export const multEigs = [
    {
        value: 'ave',
        name: '平均幅值',
    },
    {
        value: 'cle',
        name: '裕度指标',
    },
    {
        value: 'cre',
        name: '峰值指标',
    },
    {
        value: 'imp',
        name: '脉冲指标',
    },
    {
        value: 'kru',
        name: '峭度指标',
    },
    {
        value: 'max',
        name: '最大值',
    },
    {
        value: 'mean',
        name: '均值',
    },
    {
        value: 'min',
        name: '最小值',
    },
    {
        value: 'peak',
        name: '峰值',
    },
    {
        value: 'pp',
        name: '峰峰值',
    },
    {
        value: 'rms',
        name: '有效值',
    },
    {
        value: 'root',
        name: '方根幅值',
    },
    {
        value: 'sha',
        name: '波形指标',
    },
    {
        value: 'ske',
        name: '歪度指标',
    },
]

export const typeOption = [
    {
        label: '带通',
        value: 'bandpass',
    },
    {
        label: '带阻',
        value: 'bandstop',
    },
    {
        label: '低通',
        value: 'lowpass',
    },
    {
        label: '高通',
        value: 'highpass',
    },
]

export const freOption = [
    {
        label: '峰值',
        value: 'Ewpk',
    },

    {
        label: '有效值',
        value: 'Eurms',
    },
]
export const funOption = [
    {
        label: '矩形窗',
        value: 'rectangular',
    },
    {
        label: '汉宁窗',
        value: 'hanning',
    },
    {
        label: '海宁窗',
        value: 'hamming',
    },
    {
        label: '平顶窗',
        value: 'blackman',
    },
]
